<template>
  <div class="personal_purse">
    <my-header :showBack="true" :title="$t('lang.Currentsubl')" ></my-header>
    <div >
      <van-list v-show="recordList.length>0" v-model="loading" :finished="finished" @load="loadMore" :offset="10" class="trad_list"> 
			<ul >
				<li v-for="item in recordList" :key="item.index">
					<div slot="title" class="jytime">
						<div class="nflex">
							<!-- <h3>交易编号:JY5159</h3> -->
							<p>{{$t("lang.C2Ctype")}}：<span>{{item.profitZhRemark}}</span></p>
							<!--profitStatus 1 收入 2 支出 -->
							<p class="tipgren" v-if="item.profitStatus==2">-{{parseFloat(item.profitNum).toFixed(4)}}</p>
							<p class="tipred" v-if="item.profitStatus==1">+{{parseFloat(item.profitNum).toFixed(4)}}</p>
						</div>
						<div class="nflex">
							<p>{{$t("lang.Time")}}：{{item.createTime}}</p>
						</div>
					</div>
				</li>
			</ul>
      </van-list>
      <div class="no_data" v-show="recordList.length==0"><img src="../../assets/img/my/nodata.png" alt="" srcset="">{{$t("lang.NoData")}}</div>
    </div>
  </div>
</template>

<script>
import header from "@/components/header";
import { Toast } from 'vant';
import ClipboardJS from 'Clipboard'

export default {
  components: {
    "my-header": header
  }, 
  data(){
    return{
			userInfo:{},
			tradingList:[ ],
			activeName: '1',
			activeNames: ['0'],
			jyListData:[1,2,3,],
			loading: false,
      finished: true,
      recordList: [],
      searchData: {
        pageNo: 1, //当前页
        pageSize: 30, //每页30条
        type: 3
      },
    }
  },
  filters: {
    formatDate(time) {
      var date = new Date(time);
      return timeFormat.formatDate(date, "yyyy.MM.dd hh:mm");
    }
  },
  mounted(){
    this.init();
  },
  methods:{
		init() {
      this.searchData.pageNo = 1;
      this.$ajax(this.$api.selectProfit, this.searchData).then(res => {
        this.loading = false;
        if (res.code === 0) {
          if (res.msg && res.msg.list.length > 0) {
						this.recordList = res.msg.list;
            this.finished = this.searchData.pageNo == res.msg.lastPage;
            this.loading = false;
          }
        } else {
          this.recordList = [];
        }
      });
    },
    loadMore: function() {
      this.searchData.pageNo += 1;
      this.$ajax(this.$api.selectProfit, this.searchData).then(res => {
        this.loading = false;
        if (res.code === 0) {
          if (res.msg && res.msg.list.length > 0) {
            this.recordList = this.recordList.concat(res.msg.list);
            this.finished = this.searchData.pageNo == res.msg.lastPage;
            this.loading = false;
          }
        }
      });
    },
  }
}
</script>

<style lang='less' scoped>
.trad_list{
	background: #f6f6f6;
		box-sizing: border-box;padding:0px 12px;background:#ffffff;margin-top:0px;
		h3{color: #333333;line-height: 26px;}
		li{padding: 10px 0;border-bottom: 1px solid #eeeeee;}
		.nflex{display: flex;justify-content:space-between ;
			p{line-height: 24px;color: #999999;}
			span{color: #333333;}
			.npadd{padding: 15px 0;}
			.tiphui{color: #999999;}
			.tipred{color: #FF5458;}
			.tipgren{color: #00BA4F;}
		}
		.buybtn{color: #FF4954;border: 1px solid #FF4954;border-radius: 20px;padding: 0 6px ;}		
}
.jytime{
	h3{color: #333333;font-size: 14px;}
	p{color: #CCCCCC;}
	}
</style>
